<?php

namespace app\admin\validate;

use \think\Validate;

/**
 *  权限表验证规则
 */


class Auth extends Validate
{

    protected $rule = [
        'id' => 'require|number',
        'page' => 'require|number',
        'module' => 'require|length:1,4',
        'authname' => 'require',
        'route' => 'require',
        'remark' => 'require',

    ];

    //定义验证提示
    protected $message = [
        'id.require' => 'ID 不能为空',
        'id.number' => 'ID 只能是数字',
        'page.require' => 'page 不能为空',
        'page.number' => 'page 只能是数字',
        'module.require' => '模块不能为空',
        'module.length' => '模块名不能超过4位',
        'authname.require' => '权限名称不能为空',
        'route.require' => '访问路径路径不能为空',
        'remark.require' => '备注不能为空',

    ];

    //定义验证场景
    protected $scene = [
        'list' => ['page'],
        'save' => ['module','authname','route'],
        'detail' => ['id'],
        'remove' => ['id'],
        'del' => ['id']
    ];


}
